package cn.wolfcode.web.interceptor;

import cn.wolfcode.domain.Employee;
import cn.wolfcode.util.UserContext;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class CheckLoginInterceptor implements HandlerInterceptor {

//    @Override
//    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//        //获取session中的数据
//        //Object employee = request.getSession().getAttribute("EMPLOYEE_IN_SESSION");
//        Employee employee = UserContext.getCurrentUser();
//        //判断employee是否为空
//        if (employee == null) {
//            //为空表示未登录,需要重定向至登录页面
//            response.sendRedirect("/login.html");
//            return false;
//        }
//        return true;
//    }
}
